package com.example.zzl.adapter.SearchFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

/**
 * Created by zhang on 2016/12/9.
 */

public class SearchFrgmentAdapter extends FragmentStatePagerAdapter {
    private ArrayList<Fragment> list;
    private String[] titles;
    public SearchFrgmentAdapter(FragmentManager fm, ArrayList<Fragment> fragments,String[] titles ) {
        super(fm);
        this.list=fragments;
        this.titles = titles ;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public void notifyDataSetChanged() {
        super.notifyDataSetChanged();

    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

}
